package com.server.config;

import javax.annotation.Resource;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.server.interceptor.ProjectInterceptor;

@Configuration
public class SpringFilterSupport implements WebMvcConfigurer {
    // 拦截器配置
    // 注入拦截器，对指定请求路由拦截
    @Resource
    private ProjectInterceptor loginCheckInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginCheckInterceptor)
                .addPathPatterns("/**")
                // 不拦截的请求  如登录接口,测试接口,代理接口
                .excludePathPatterns("/admin/**")
                .excludePathPatterns("/admin_page/**")
                .excludePathPatterns("/test/**")
                .excludePathPatterns("/page/**");
    }

}